<%--
  Created by IntelliJ IDEA.
  User: 杨娇
  Date: 2025/6/23
  Time: 10:01
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>绿能充 - 添加充电桩</title>
    <link href="https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
    <style>
        :root {
            --primary-color: #00a896;
            --secondary-color: #02c39a;
            --dark-color: #05668d;
            --light-color: #f0f3bd;
            --accent-color: #028090;
            --text-dark: #333;
            --text-light: #f8f9fa;
            --shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
            --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Noto Sans SC', sans-serif;
            color: var(--text-dark);
            background-color: #f9f9f9;
            min-height: 100vh;
            display: flex;
        }

        /* 侧边栏样式 - 与列表页面完全一致 */
        .sidebar {
            width: 250px;
            background: linear-gradient(135deg, var(--dark-color) 0%, var(--primary-color) 100%);
            color: white;
            padding: 20px 0;
            height: 100vh;
            position: fixed;
            box-shadow: var(--shadow);
            z-index: 100;
        }

        .sidebar-header {
            padding: 0 20px 20px;
            border-bottom: 1px solid rgba(255, 255, 255, 0.1);
            margin-bottom: 20px;
        }

        .sidebar-header .logo {
            display: flex;
            align-items: center;
            margin-bottom: 15px;
        }

        .sidebar-header .logo-icon {
            width: 40px;
            height: 40px;
            background-color: rgba(255, 255, 255, 0.2);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            margin-right: 10px;
            font-size: 18px;
            color: var(--light-color);
        }

        .sidebar-header h3 {
            font-size: 1.2rem;
            font-weight: 500;
            margin: 0;
        }

        .sidebar-header p {
            font-size: 0.8rem;
            opacity: 0.8;
            margin: 0;
        }

        .nav-menu {
            list-style: none;
            padding: 0 15px;
        }

        .nav-item {
            margin-bottom: 5px;
        }

        .nav-link {
            display: flex;
            align-items: center;
            padding: 12px 15px;
            color: rgba(255, 255, 255, 0.8);
            text-decoration: none;
            border-radius: 8px;
            transition: var(--transition);
        }

        .nav-link:hover, .nav-link.active {
            background-color: rgba(255, 255, 255, 0.1);
            color: white;
        }

        .nav-link i {
            margin-right: 10px;
            width: 20px;
            text-align: center;
            font-size: 16px;
        }

        .user-profile {
            position: absolute;
            bottom: 20px;
            left: 0;
            width: 100%;
            padding: 0 20px;
        }

        .user-info {
            display: flex;
            align-items: center;
            padding: 10px;
            background-color: rgba(255, 255, 255, 0.1);
            border-radius: 8px;
            cursor: pointer;
            transition: var(--transition);
        }

        .user-info:hover {
            background-color: rgba(255, 255, 255, 0.2);
        }

        .user-avatar {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            background-color: rgba(255, 255, 255, 0.2);
            display: flex;
            align-items: center;
            justify-content: center;
            margin-right: 10px;
            font-size: 14px;
        }

        .user-name {
            font-size: 0.9rem;
            font-weight: 500;
            margin-bottom: 2px;
        }

        .user-role {
            font-size: 0.7rem;
            opacity: 0.8;
        }

        /* 主内容区样式 */
        .main-content {
            flex: 1;
            margin-left: 250px;
            padding: 30px;
        }

        .header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 30px;
        }

        .page-title h1 {
            font-size: 1.8rem;
            font-weight: 600;
            color: var(--dark-color);
            margin-bottom: 5px;
        }

        .page-title p {
            color: #777;
            font-size: 0.9rem;
            margin: 0;
        }

        .header-actions {
            display: flex;
            gap: 10px;
        }

        .btn {
            padding: 8px 16px;
            border-radius: 8px;
            font-size: 0.9rem;
            font-weight: 500;
            border: none;
            cursor: pointer;
            transition: var(--transition);
            display: flex;
            align-items: center;
        }

        .btn i {
            margin-right: 6px;
        }

        .btn-primary {
            background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
            color: white;
            box-shadow: 0 4px 15px rgba(0, 168, 150, 0.3);
        }

        .btn-primary:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 20px rgba(0, 168, 150, 0.4);
        }

        .btn-outline {
            background: transparent;
            border: 1px solid #ddd;
            color: #555;
        }

        .btn-outline:hover {
            background-color: #f5f5f5;
        }

        /* 表单卡片样式 */
        .form-card {
            background-color: white;
            border-radius: 12px;
            box-shadow: var(--shadow);
            padding: 30px;
            margin-bottom: 20px;
            transition: var(--transition);
            position: relative;
            overflow: hidden;
        }

        .form-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
        }

        .form-card::after {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 4px;
            background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
        }

        .form-header {
            margin-bottom: 25px;
            padding-bottom: 15px;
            border-bottom: 1px solid #eee;
        }

        .form-header h3 {
            font-size: 1.3rem;
            font-weight: 600;
            margin: 0;
            color: var(--dark-color);
        }

        .form-group {
            margin-bottom: 20px;
        }

        .form-group label {
            display: block;
            margin-bottom: 8px;
            font-weight: 500;
            color: #555;
        }

        .form-control {
            width: 100%;
            padding: 12px 15px;
            border: 1px solid #ddd;
            border-radius: 8px;
            font-family: inherit;
            font-size: 0.9rem;
            transition: var(--transition);
        }

        .form-control:focus {
            outline: none;
            border-color: var(--primary-color);
            box-shadow: 0 0 0 2px rgba(0, 168, 150, 0.2);
        }

        .form-row {
            display: flex;
            gap: 20px;
            margin-bottom: 20px;
        }

        .form-col {
            flex: 1;
        }

        .form-actions {
            display: flex;
            justify-content: flex-end;
            gap: 15px;
            margin-top: 30px;
            padding-top: 20px;
            border-top: 1px solid #eee;
        }

        /* 响应式设计 */
        @media (max-width: 992px) {
            .sidebar {
                width: 70px;
                overflow: hidden;
            }

            .sidebar-header h3,
            .sidebar-header p,
            .nav-link span,
            .user-name,
            .user-role {
                display: none;
            }

            .sidebar-header {
                padding: 15px 10px;
            }

            .nav-link {
                justify-content: center;
                padding: 12px 0;
            }

            .nav-link i {
                margin-right: 0;
                font-size: 18px;
            }

            .main-content {
                margin-left: 70px;
            }
        }

        @media (max-width: 768px) {
            .form-row {
                flex-direction: column;
                gap: 15px;
            }
            .header {
                flex-direction: column;
                align-items: flex-start;
                gap: 15px;
            }
        }

        @media (max-width: 576px) {
            .main-content {
                padding: 20px 15px;
            }
            .form-actions {
                flex-direction: column;
            }
            .btn {
                width: 100%;
                justify-content: center;
            }
        }
    </style>
</head>
<body>
<!-- 侧边导航栏 - 与列表页面完全一致 -->
<div class="sidebar">
    <div class="sidebar-header">
        <div class="logo">
            <div class="logo-icon">
                <i class="fas fa-charging-station"></i>
            </div>
            <div>
                <h3>绿能充</h3>
                <p>管理员面板</p>
            </div>
        </div>
    </div>

    <ul class="nav-menu">
        <li class="nav-item">
            <a href="/admin/dashboard" class="nav-link">
                <i class="fas fa-tachometer-alt"></i>
                <span>仪表盘</span>
            </a>
        </li>
        <li class="nav-item">
            <a href="/admin/user/list" class="nav-link">
                <i class="fas fa-users"></i>
                <span>用户管理</span>
            </a>
        </li>
        <li class="nav-item">
            <a href="/admin/pile/list" class="nav-link active">
                <i class="fas fa-charging-station"></i>
                <span>充电桩管理</span>
            </a>
        </li>
        <li class="nav-item">
            <a href="/admin/announcement/list" class="nav-link">
                <i class="fas fa-bullhorn"></i>
                <span>公告管理</span>
                <span class="badge">2</span>
            </a>
        </li>
        <li class="nav-item">
            <a href="/admin/report/list" class="nav-link">
                <i class="fas fa-list-alt"></i>
                <span>充电记录</span>
            </a>
        </li>
        <li class="nav-item">
            <a href="/admin/fault/list" class="nav-link">
                <i class="fas fa-exclamation-triangle"></i>
                <span>故障报告</span>
            </a>
        </li>
        <li class="nav-item">
            <a href="/admin/settings" class="nav-link">
                <i class="fas fa-cog"></i>
                <span>系统设置</span>
            </a>
        </li>
    </ul>

    <div class="user-profile">
        <div class="user-info">
            <div class="user-avatar">
                <i class="fas fa-user"></i>
            </div>
            <div>
                <div class="user-name">管理员</div>
                <div class="user-role">超级管理员</div>
            </div>
        </div>
    </div>
</div>

<!-- 主内容区 -->
<div class="main-content">
    <div class="header">
        <div class="page-title">
            <h1>添加充电桩</h1>
            <p>添加新的充电桩设备信息</p>
        </div>
        <div class="header-actions">
            <a href="${pageContext.request.contextPath}/admin/pile/list" class="btn btn-outline">
                <i class="fas fa-arrow-left"></i> 返回列表
            </a>
        </div>
    </div>

    <!-- 表单区域 -->
    <form action="${pageContext.request.contextPath}/admin/pile/add" method="post">
        <div class="form-card">
            <div class="form-header">
                <h3>基本信息</h3>
            </div>

            <div class="form-row">
                <div class="form-col">
                    <div class="form-group">
                        <label for="code">充电桩编号 *</label>
                        <input type="text" id="code" name="code" class="form-control" required placeholder="请输入充电桩唯一编号">
                    </div>
                </div>
                <div class="form-col">
                    <div class="form-group">
                        <label for="name">充电桩名称 *</label>
                        <input type="text" id="name" name="name" class="form-control" required placeholder="请输入充电桩名称">
                    </div>
                </div>
            </div>

            <div class="form-group">
                <label for="location">详细地址 *</label>
                <input type="text" id="location" name="location" class="form-control" required placeholder="请输入充电桩详细地址">
            </div>

            <div class="form-row">
                <div class="form-col">
                    <div class="form-group">
                        <label for="latitude">纬度</label>
                        <input type="number" step="0.000001" id="latitude" name="latitude" class="form-control" placeholder="请输入纬度坐标">
                    </div>
                </div>
                <div class="form-col">
                    <div class="form-group">
                        <label for="longitude">经度</label>
                        <input type="number" step="0.000001" id="longitude" name="longitude" class="form-control" placeholder="请输入经度坐标">
                    </div>
                </div>
            </div>

            <div class="form-row">
                <div class="form-col">
                    <div class="form-group">
                        <label for="type">充电类型 *</label>
                        <select id="type" name="type" class="form-control" required>
                            <option value="">请选择充电类型</option>
                            <option value="AC">交流慢充</option>
                            <option value="DC">直流快充</option>
                        </select>
                    </div>
                </div>
                <div class="form-col">
                    <div class="form-group">
                        <label for="power">功率(kW) *</label>
                        <input type="number" step="0.1" id="power" name="power" class="form-control" required placeholder="请输入充电桩功率">
                    </div>
                </div>
            </div>

            <div class="form-row">
                <div class="form-col">
                    <div class="form-group">
                        <label for="status">状态 *</label>
                        <select id="status" name="status" class="form-control" required>
                            <option value="AVAILABLE">可用</option>
                            <option value="CHARGING">充电中</option>
                            <option value="FAULT">故障</option>
                            <option value="MAINTENANCE">维护中</option>
                        </select>
                    </div>
                </div>
                <div class="form-col">
                    <div class="form-group">
                        <label for="price">价格(元/度) *</label>
                        <input type="number" step="0.01" id="price" name="price" class="form-control" required placeholder="请输入充电价格">
                    </div>
                </div>
            </div>

            <div class="form-row">
                <div class="form-col">
                    <div class="form-group">
                        <label for="operator">运营商</label>
                        <input type="text" id="operator" name="operator" class="form-control" placeholder="请输入运营商名称">
                    </div>
                </div>
                <div class="form-col">
                    <div class="form-group">
                        <label for="manufacturer">生产厂家</label>
                        <input type="text" id="manufacturer" name="manufacturer" class="form-control" placeholder="请输入生产厂家">
                    </div>
                </div>
            </div>

            <div class="form-group">
                <label for="description">描述信息</label>
                <textarea id="description" name="description" class="form-control" rows="3" placeholder="请输入充电桩描述信息"></textarea>
            </div>

            <div class="form-actions">
                <button type="reset" class="btn btn-outline">
                    <i class="fas fa-redo"></i> 重置
                </button>
                <button type="submit" class="btn btn-primary">
                    <i class="fas fa-save"></i> 保存
                </button>
            </div>
        </div>
    </form>
</div>

<script>
    // 表单验证逻辑可以在这里添加
    document.querySelector('form').addEventListener('submit', function(e) {
        // 可以添加表单验证逻辑
        // 如果验证不通过，可以调用 e.preventDefault() 阻止表单提交
    });
</script>
</body>
</html>
